<template>
	<view class="evaluate">
		<u-navbar title="签到列表" @rightClick="rightClick" :autoBack="true" rightText="筛选" rightColor="#528efe"
			leftIconColor="#528efe">
		</u-navbar>
		<button @click="show = true">筛选</button>
		<div class="time_con" v-for="item in list" :key="item.id">
			<div class="top">

				<div class="left">
					<img src="../static/my/userH.png" alt="" class="img" @click="goMy(item)" />
					<p class="p1">
					<div class="cons">

						{{item.name}}
						<view class="mm">
							销售经理
						</view>
					</div>
					<p class="p11">{{item.birthday}}</p>
					</p>

				</div>

				<div class="right">
					<p class="p3">

					<p class="mn">工单签到</p>
					</p>
				</div>
			</div>
			<p class="p2" @click="goditu">
				<u-icon name="map" color="#cccccc" size="15"></u-icon>广东省深圳市南山区科技园中区科苑路15号
			</p>
			<div class="p2" @click="govjui">
				<u-icon name="order" color="#cccccc" size="15"></u-icon>深圳木卫二科技有限公司
			</div>
		</div>
		<u-popup :show="show" mode="right" closeable="true" safeAreaInsetTop="true" @close="close" @open="open">
			<div class="box">

				<div class="top">
					<p>数据筛选</p>
				</div>
				<div class="con">
					<div class="conTop">
						<p class="yb">查看范围</p>
						<div class="ybT">
							<p class="p1" @click="active = 1" :class="active === 1 ? 'active' : '' ">我自己的</p>
							<p class="p1" @click="active = 2" :class="active === 2 ? 'active' : '' ">我下属的</p>
							<p class="p1" @click="active = 3" :class="active === 3 ? 'active' : '' ">所有成员</p>
						</div>
					</div>
					<div class="conTops">
						<p class="yb">
							指定成员
						</p>
						<div class="ybT">
							<p class="p1">
								<u-icon name="account-fill" color="#cdcdcd" size="20"></u-icon>
							<p>赵小刚</p>
							</p>
							<p class="p1">
								<u-icon name="account-fill" color="#cdcdcd" size="20"></u-icon>
							<p>周小明</p>
							</p>
							<p class="p1">
								<u-icon name="account-fill" color="#cdcdcd" size="20"></u-icon>
							<p>郭小涛</p>
							</p>
							<p class="p1" @click="goxrze">
								<u-icon name="plus-circle" color="#cdcdcd" size="20"></u-icon>
							<p>更多</p>
							</p>
						</div>
					</div>
					<div class="conTopss">
						<div class="yb">指定部门</div>
						<div class="ybT" @click="goxrzebumf">
							<u-icon name="man-add-fill" color="#cdcdcd" size="20"></u-icon>选择部门
						</div>
					</div>
					<div class="conTopsss">
						<div class="yb">指定时间</div>
						<div class="ybT">
							<p class="p1" @click="active1 = 1" :class="active1 === 1 ? 'active1' : '' ">今天</p>
							<p class="p1" @click="active1 = 2" :class="active1 === 2 ? 'active1' : '' ">昨天</p>
							<p class="p1" @click="active1 = 3" :class="active1 === 3 ? 'active1' : '' ">本周</p>
							<p class="p1" @click="active1 = 4" :class="active1 === 4 ? 'active1' : '' ">上周</p>
							<p class="p1" @click="active1 = 5" :class="active1 === 5 ? 'active1' : '' ">本月</p>
							<p class="p1" @click="active1 = 6" :class="active1 === 6 ? 'active1' : '' ">上月</p>
						</div>
					</div>
					<div class="conTopssss">
						<div class="yb">自定义时间段</div>
						<div class="ybT" @click="show1 = true">
							<u-icon name="clock" color="#cdcdcd" size="20"></u-icon>选择时间范围
						</div>
						
					</div>
					<div>
						<p>开始的时间：{{time[0]}}</p>
						<p>结束的时间：{{time[time.length-1]}}</p>
					</div>
					
					<div class="bot">
						<p class="p1" @click="show = false">重置</p>
						<p class="p1" @click="show = false">确认</p>
					</div>
				</div>
			</div>
		</u-popup>
		<up-calendar :show="show1" 
		    color="#f56c6c" :mode="mode" @confirm="confirm"></up-calendar>
	</view>
</template>

<script>
	import {
		onMounted,
		ref
	} from 'vue'
	export default {
		data() {
			return {
				show: false,
				active: 1,
				active1: 1,
			}
		},
		methods: {
			open() {
				// console.log('open');
			},
			close() {
				this.show = false
				// console.log('close');
			},
			goxrze() {
				uni.navigateTo({
					url: '/pages/message/crunch/xrzeigyr/xrzeigyr'
				})
			},
			goxrzebumf() {
				uni.navigateTo({
					url: '/pages/message/crunch/xrzebumf/xrzebumf'
				})
			},
			goditu(){
				uni.navigateTo({
					url:'/pages/message/crunch/ditu/ditu'
				})
			},
			govjui(){
				uni.navigateTo({
					url:'/pages/message/crunch/igui/igui'
				})
			}
		},

		setup() {

			const list = ref([])
			const show1 = ref(false);
			const mode = ref('range');
			const time = ref([])
			
			const confirm = (e) => {
			  console.log(e);
			  time.value = e
			  console.log(e[0])
			  show1.value = false
			}
			onMounted(() => {
				getData()
			})
		

			const getData = () => {
				wx.request({
					url: 'http://localhost:3000/getData',
					method: 'POST',
					data: {
						// 请求参数
					},
					header: {
						// 请求头
						'content-type': 'application/json'
					},
					success: function(res) {
						const {
							data
						} = res.data
						console.log('请求成功', data);
						list.value = data
						getTime()

					},
					fail: function(err) {
						console.log('请求失败', err);
						// 处理请求失败
					}
				});
			}
			const goMy = (item) => {
				uni.navigateTo({
					url: `/pages/my/gerf/gerf?data=${JSON.stringify(item)}`
				})
			}
			return {
				list,
				getData,
				goMy,
				show1,
				mode,
				confirm,
				time
				
			}
		}
	}
</script>

<style scoped lang="scss">
	.box {
		width: 400rpx;
		box-sizing: border-box;
		position: relative;
		height: 100%;

		// padding: 10rpx 20rpx;
		.bot {
			position: absolute;
			bottom: 0px;
			display: flex;
			height: 100rpx;
			border-top: 1rpx solid #f2f2f2;
			align-items: center;
			width: 100%;

			// justify-content: space-evenly;
			.p1 {
				width: 50%;
				height: 100%;
				text-align: center;
				line-height: 100rpx;
				// background-color: wheat;
			}

			.p1:nth-of-type(2) {

				background-color: #0079fe;
				color: white;
			}

			.p1:nth-of-type(1) {
				background-color: white;
				color: #0079fe;
			}
		}

		.top {
			width: 100%;
			height: 100rpx;
			display: flex;
			align-items: center;
			border-top: 1px solid #f2f2f2;
			border-bottom: 1px solid #f2f2f2;
			padding: 0rpx 10rpx;
			font-weight: 700;
			font-size: 30rpx;
			color: #666666;
		}

		.ybT {
			display: flex;
			justify-content: space-evenly;
			flex-wrap: wrap;

			.p1 {
				font-size: 25rpx;
				// padding: 10rpx;
				height: 60rpx;
				width: 130rpx;
				border: 1px solid #f2f2f2;
				text-align: center;
				color: #999999;
				line-height: 60rpx;
			}
		}

		.yb {
			font-size: 25rpx;
			color: #999999;
			padding: 20rpx;
		}

		.conTop {
			.active {
				border: 1rpx solid #52c1f5;
				color: #52c1f5;
			}
		}

		.conTops {
			.ybT {
				margin: 20rpx 0;
				display: flex;
				flex-wrap: nowrap;

				.p1 {
					border: 0;
					display: flex;
					flex-direction: column;
					justify-content: center;
					align-items: center;
				}
			}
		}

		.conTopss {
			.ybT {
				border: 1px solid #f2f2f2;
				display: flex;
				padding: 10rpx 0;
			}
		}

		.conTopsss {
			.active1 {
				border: 1rpx solid #52c1f5;
				color: #52c1f5;
			}
		}

		.conTopssss {
			.ybT {
				border: 1px solid #f2f2f2;
				display: flex;
				padding: 10rpx 0;
			}

		}
	}

	.evaluate {
		width: 100%;
		height: 100%;
		box-sizing: border-box;
		padding: 0px 20rpx;
		background-color: #f8f8f8;
		padding-top: 140rpx;

		.time_con {
			// display: flex;
			margin-top: 20rpx;
			padding: 20rpx 0rpx;
			// align-items: center;
			background-color: #ffffff;
			border-radius: 20rpx;
			box-shadow: 0px 2px 5px rgba(0, 0, 0, 0.1);

			.top {
				display: flex;
				justify-content: space-between;
			}

			.img {
				width: 80rpx;
				height: 80rpx;
				border-radius: 50%;
				margin-right: 20rpx;
			}

			.img1 {
				width: 30rpx;
				height: 30rpx;
			}

			// padding: 0px ;
			.p1 {
				// margin: 15rpx 0rpx;
				margin-bottom: 15rpx;

				// display: flex;
				.cons {
					display: flex;
				}

				// margin-right: 10rpx;
				.mm {
					margin-left: 10rpx;
					font-size: 20rpx;
					color: #999999;
					margin-top: 5rpx;
				}

				.p11 {
					font-size: 25rpx;
					color: #9999a6;
				}
			}

			.p2 {
				display: flex;
				font-size: 21rpx;
				padding-left: 40rpx;
			}

			.p3 {
				// margin-top: 20rpx;
				display: flex;
				color: #99a6c4;
				align-items: center;

				.mn {
					font-size: 25rpx;
				}
			}

			.left {
				margin: 10rpx 10rpx;
				display: flex;

			}

			.right {
				// text-align: right;
				// flex: 1;
				// padding-left: 80rpx;
				// display: flex;
				padding-right: 20rpx;


			}
		}
	}
</style>